package day1104.demo02;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * @program: qy158
 * @description:
 * @author: 闫克起2
 * @create: 2022-11-04 09:40
 **/
public class Test02 {
    public static void main(String[] args) {
        List<Integer> list=new ArrayList<>();
        list.add(2);
        list.add(3);
        list.add(8);
        list.add(4);
        list.add(1);
        //Comparator<Integer> comparator=(o1,o2)->Integer.compare(o1,o2);
        Comparator<Integer> comparator=Integer::compare;
        Collections.sort(list,comparator);

        System.out.println(list);
    }
}
